<template>
    <div></div>
</template>
 
<script>
import userManager from './../../oidc'
import utils from "@/utils";
export default {
    props: {},
    data() {
        return {};
    },
    components: {},
    methods: {},
    async created() {
        try {
            await userManager.signinRedirectCallback();
            let user = await userManager.getUser();
            if (user) {
                localStorage.setItem('OidcUser', JSON.stringify(user))
                utils.setUserInfo(user.profile)
                utils.setTokenInfo(user.access_token, user.refresh_token)
                this.$router.push("/index")
            } else {
                userManager.signinRedirect(); //执行重定向 
            }
        } catch (e) {
            console.log(e)
        }
    }
};
</script>